﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;
namespace NASM_Develop_IDE
{
    public class IDEPreferences
    {
        public bool AllowPlugins { get; set; }
        public string NASMTemplate { get; set; }
        public string PluginBinPath { get; set; }
        public override string ToString()
        {
            return "XML Based IDE Preferences Settings";
        }
        public void Save()
        {
            XmlSerializer serializer = new XmlSerializer(this.GetType());
            using (FileStream stream = File.Create("nasmdevide.conf"))
            {
                serializer.Serialize(stream, this);
            }
        }
        public static IDEPreferences Open(string filePath)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(IDEPreferences));
            using (FileStream stream = File.Open(filePath, FileMode.Open))
            {
                return serializer.Deserialize(stream) as IDEPreferences;
            }
        }
    }
}
